package correct.day11;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Test33 {
    public static void Reverse(char[] s, int left, int right) {
        int l = left, r = right;
        while(l < r) {
            char ch = s[l];
            s[l] = s[r];
            s[r] = ch;
            l++;
            r--;
        }
    }

    public static void main(String[] args) throws Throwable {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] s = br.readLine().toCharArray();
        int n = s.length;
        Reverse(s, 0, n - 1);
        int left = 0;
        while(left < n) {
            int right = left;
            while(right < n && s[right] != ' ')
                right++; // 找单词
            Reverse(s, left, right - 1);
            while(right < n && s[right] == ' ')
                right++; // 跳过空格
            left = right;
        }
        for(char ch : s) System.out.print(ch);
    }
}
